package cn.csq;

import java.util.concurrent.*;

/**
 * @author <a href="mailto:csq02198031@alibaba-inc.com">chengshanqing</a>
 * @date 2025/9/25 10:13
 */
public class ThreadPoolNewTest {
    public static void main(String[] args) {

        //
        ExecutorService executorService = Executors.newFixedThreadPool(1);
        ExecutorService executorService2 = Executors.newCachedThreadPool();
        ExecutorService executorService3 = Executors.newSingleThreadExecutor();
        ExecutorService executorService4 = Executors.newScheduledThreadPool(1);

        executorService.execute(() -> {
            System.out.println("hello world");
        });
        executorService.shutdown();

        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 50, 1000, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
        threadPoolExecutor.execute(() -> {
            System.out.println("hello world");
        });
        threadPoolExecutor.shutdown();

        ThreadPoolExecutor threadPoolExecutor2 = new ThreadPoolExecutor(10, 50, 1000, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());

    }
}
